using LuckyLang.AST.Expression.ValueTyre;

namespace LuckyLang.AST.Expression;

public class Value : Expression
{
    public object TheValue { get; set; }

    public override Value  GetValue(ref VariateManager Manager) => this;
    public override string ToString()                           => TheValue.ToString();
    public virtual  Value  PlusValue(Value      other)          => new Value();
    public virtual  Value  MinusValue(Value     other)          => new Value();
    public virtual  Value  TimesValue(Value     other)          => new Value();
    public virtual  Value  DivideValue(Value    other)          => new Value();
    public virtual  bool   LesserValue(Value    other)          => false;
    public virtual  bool   GreaterValue(Value   other)          => false;
    public virtual  bool   EqualsValue(Value    other)          => TheValue == other.TheValue;
    public virtual  bool   LessEqValue(Value    other)          => false;
    public virtual  bool   GreaEqValue(Value    other)          => false;
    public virtual  bool   DifferentValue(Value other)          => TheValue != other.TheValue;
    public virtual Value Dot(Expression expr)
    {
        //dot tostr id.tostr => TheValue.ToString()
        if (expr is ID)
        {
            var a = expr as ID;
            if (a.IdName == "tostr")
                return new StringValue(ToString());
        }
        return null;
    }
}
